/**
 *
 * $Id: IOData.i,v 1.1 2009-09-29 10:07:16 ttaipalu Exp $
 *
 * \file
 * \brief Python wrap for MaCI - IO Data parser header
 * \author Matthieu Myrsky <matthieu.myrsky@tkk.fi>
 * \author Tapio Taipalus <tapio.taipalus@tkk.fi>
 */

%{
	#include "MaCIData.hpp"
	#include "timestamp.hpp"
	#include "IOTypes.hpp"
	#include "IOData.hpp"
	#include <stdio.h>
	#include "owndebug.h"
%}
	
	%include "../MaCIData.i"
	%include "../common/timestamp.i"	

namespace gim {
  class CBinBag;
}


namespace MaCI {
  namespace IO {

    /** IO Data Decoder/Encoder.
     * This class implements the io data decoding and encoding to/from binbag
     *
     */
    class CIOData : public CMaCIData
    {
    public:
       /** Constructor of CIOData
       *
       */
      CIOData(void);

      /** Destructor of CIOData
       *
       */
      ~CIOData(void);


      /** Copy constructor for IOData. 
       *
       * The copy constructor duplicates the input object to maximum
       * depth (All containers are duplicated too). After a copy is
       * constructed, no dependencies to original Data element exist.
       *
       * @param[in] aIOData Reference to CIOData container to copy.
       */
      CIOData(const MaCI::IO::CIOData &aIOData);

      /** Assignment operator for IOData.
       *
       * The assignment operator duplicates the input object to
       * maximum depth (All containers are duplicated too). After a
       * copy is constructed, no dependencies to original Data element
       * exist.
       *
       * @param[in] aIOData Reference to CIOData container to copy.
       */
      CIOData &operator=(const MaCI::IO::CIOData &aIOData);

      ///////////////////////////////////////////////////
      // Derived from 'CMaCIData', see description there.
      bool DecodeFrom(gim::binbag::CBinBag *aBinBag = NULL);
      void Reset();
      void Print(const int level) const;
      ///////////////////////////////////////////////////


      // Setter commands
      /** Set Timestamp element.
       * 
       * \see Common::TTimestamp
       *
       * @param[in] aStamp      Timestamp element to set.
       * @return                'true' if no such element previously
       *                        exists, and a valid CBinBag backend exists.
       */
      bool SetTimestamp(const MaCI::Common::TTimestamp &aStamp);

	  bool SetDigitalPinState(const MaCI::IO::TDigitalPinState &aState);

	  bool SetDigitalBlockState(const MaCI::IO::TDigitalBlockState &aState);

	  bool SetAnalogVoltage(const MaCI::IO::TAnalogVoltage &aAnalogVoltage);

	  bool SetDigitalBlockMask(const MaCI::IO::TDigitalBlockMask &mask);

      /** Set Command element.
       *
       * Command elements must be accompanied by related dataelement
       * when required by commandtype. See the command enumerations
       * for a note about required datatype. (For example, 'SetDigitalPin'
       * command required a 'DigitalPin' datatype after the command.
       * 
       * \see TCommand
       *
       * @param[in] aCmd        Command element to set.
       * @return                'true' if no such element previously
       *                        exists, and a valid CBinBag backend exists.
       */
      bool SetCommand(const MaCI::IO::TCommand &aCmd);
      // Getter commands

      /** Get constantpointer to TCommand element (if such exists).
       *
       * \see TCommand
       * 
       * @return                constant Pointer to command
       *                        element if such element exists
       *                        in the container. If the element 
       *                        doesn't exist, NULL is returned.
       */
      const MaCI::IO::TCommand *GetCommand(void) const;
      /** Get pointer to Common::TTimestamp element (if such exists).
       *
       * \see Common::TTimestamp
       * 
       * @return                Constant pointer to timestamp
       *                        element if such element exists
       *                        in the container. If the element 
       *                        doesn't exist, NULL is returned.
       */
      const Common::TTimestamp *GetTimestamp(void) const;
      
      
	  const MaCI::IO::TDigitalPinState *GetDigitalPinState(void) const;
      
	  const MaCI::IO::TDigitalBlockState *GetDigitalBlockState(void) const;
      
	  const MaCI::IO::TAnalogVoltage *GetAnalogVoltage(void) const;


	  const MaCI::IO::TDigitalBlockMask *GetDigitalBlockMask(void) const;
    };
  }
}

